//
//  Ext+UIView.swift
//  DKE-Album
//
//  Created by 杨东宝 on 2018/7/26.
//  Copyright © 2018年 杨东宝. All rights reserved.
//

import UIKit
import Toast_Swift
public extension UIView {
    
    var x: CGFloat {
        get {
            return self.frame.origin.x
        }
        set {
            self.frame.origin.x = newValue
        }
    }
    
    var y: CGFloat {
        get {
            return self.frame.origin.y
        }
        set {
            self.frame.origin.y = newValue
        }
    }
    
    var width: CGFloat {
        get {
            return self.frame.size.width
        }
        set {
            self.frame.size.width = newValue
        }
    }
    
    var height: CGFloat {
        get {
            return self.frame.size.height
        }
        set {
            self.frame.size.height = newValue
        }
    }
    
    var size: CGSize {
        get {
            return self.frame.size
        }
        set {
            self.frame.size = newValue
        }
    }
    
    var centerX: CGFloat {
        get{
            return self.center.x
        }
        set{
            self.center.x = newValue
        }
    }
    
    var centerY: CGFloat {
        get {
            return self.center.y
        }
        set {
            self.center.y = newValue
        }
    }
 
    func showToastCenter (message:String) {
       self.makeToast(message,duration: 2.0,position: .center)
    }
    func showToastBottom (message:String) {
        self.makeToast(message,duration: 2.0,position: .bottom)
    }
    func showToastTop(message:String) {
        self.makeToast(message,duration: 2.0,position: .top)
    }
    
    func showToastCenterDru (message:String, duration: TimeInterval = ToastManager.shared.duration) {
       self.makeToast(message,duration: duration,position: .center)
    }
    func showToastBottomDru (message:String, duration: TimeInterval = ToastManager.shared.duration) {
        self.makeToast(message,duration: duration,position: .bottom)
    }
    func showToastTopDru(message:String, duration: TimeInterval = ToastManager.shared.duration) {
        self.makeToast(message,duration: duration,position: .top)
    }

}
